package com.taikang.hmp;

import java.util.Random;
/**
 * 生成激活码
 * @author itw_qirp
 *
 */
public class CreateActivation {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		//生成20个
		for (int i = 1; i <= 500; i++) {
			System.out.println(getCharAndNum(8));
		}
	}

	private static String getCharAndNum(int length) {
		String val = "";
		Random random = new Random();
		for (int i = 0; i < length; i++) {
			String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num";
			if ("char".equalsIgnoreCase(charOrNum)) {
				int choice = random.nextInt(2) % 2 == 0 ? 65 : 97;
				val += (char) (choice + random.nextInt(26));
			} else if ("num".equalsIgnoreCase(charOrNum)) {
				val += String.valueOf(random.nextInt(10));
			}
		}
		val = val.toUpperCase();
		return val;
	}

}
